{template 'common/header'}
{template 'common'}
{template 'shopping_nav'}


<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
		<input type="hidden" name="id" value="{$adv['id']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				幻灯片设置
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="displayorder" class="form-control" value="{$adv['displayorder']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>幻灯片标题</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='advname' name="advname" class="form-control" value="{$adv['advname']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片图片</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_image('thumb', $adv['thumb'])}
					</div>
				</div>
				 <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片连接</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="link" class="form-control" value="{$adv['link']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
					<div class="col-sm-9 col-xs-12">
						<label class='radio-inline'>
							<input type='radio' name='enabled' value=1' {if $adv['enabled']==1}checked{/if} /> 是
						</label>
						<label class='radio-inline'>
							<input type='radio' name='enabled' value=0' {if $adv['enabled']==0}checked{/if} /> 否
						</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">所属小区</label>
					<div class="col-sm-9 col-xs-12">
						 <label class="checkbox-inline">  
		                    <input type="checkbox" id="checkAll" name="checkAll">全部
		                </label>
		                {loop $regions $region}
		                    <label class="checkbox-inline">
		                      <input type="checkbox" id="" value="{$region['id']}" name='regionid[]' {if @in_array($region['id'], $regs)}checked='checked' {/if}> {$region['title']}
		                    </label>
		                {/loop}
					</div>
				</div>
			</div>
		</div>
<div class="form-group col-sm-12">
	<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
	<input type="hidden" name="token" value="{$_W['token']}" />
	</div>
	</form>
</div>

<script language='javascript'>
	function formcheck() {
		if ($("#advname").isEmpty()) {
			Tip.focus("advname", "请填写幻灯片名称!");
			return false;
		}
		return true;
	}
	$(function() {
	     $("#checkAll").click(function() {
	         $('input[name="regionid[]"]').attr("checked",this.checked); 
	     });
	});
</script>

{template 'common/footer'}